/**
 * @Author fxg1997
 * @version 1.0
*/
<template>
  <div class="pages_content table">
    <el-container>
      <el-header>
        <breaDcrumb />
      </el-header>
      <el-main style="display: flex">
        <div>
          <div class="header_right" @click="showCardNav = !showCardNav">
            <div class="title">搜索</div>
            <div>
              <transition name="from"></transition>
              <span v-show="!showCardNav">
                <i style="margin-right: 5px" class="el-icon-arrow-down"></i>
              </span>
              <transition name="to"></transition>
              <span v-show="showCardNav">
                <i style="margin-right: 5px" class="el-icon-arrow-up"></i>
              </span>
            </div>
          </div>
          <div v-show="showCardNav" class="hr"></div>
          <el-collapse-transition>
            <div v-show="showCardNav">
              <div class="search">
                <span style="display: inline-block;margin-bottom: 10px;">
                  <span style="margin-right: 12px">任务名称：</span>
                  <el-input v-model="tableParam.name" style="width: 240px" clearable placeholder="请输入" />
                </span>
                <span style="margin-left: 24px">
                  <span style="margin-right: 12px">状态：</span>
                  <el-select v-model="tableParam.transferStatus" style="width: 120px" placeholder="请选择">
                    <el-option label="全部" value=""></el-option>
                    <el-option label="已启动" :value="1"></el-option>
                    <el-option label="未启动" :value="0"></el-option>
                    <el-option label="异常中断" :value="2"></el-option>
                  </el-select>
                </span>
                <el-button icon="el-icon-search" size="medium" class="bottom_all" @click="(tableParam.page = 1), gettableData()">查 询</el-button>
                <el-button size="medium" class="bottom_all_two" style="margin-left: 12px" @click="init()">重 置</el-button>
              </div>
            </div>
          </el-collapse-transition>
          <div class="hr"></div>
          <div class="card">
            <div class="card_nav">
              <div>
                <el-button size="small" class="bottom_all" style="margin-left: 0" @click="pagesaddFromDate('添加')">
                  <i class="icon iconfont iconicon_button_add" style="font-size: 12px"></i>
                  添加
                </el-button>
              </div>
              <div>
                <el-dropdown :hide-on-click="false" trigger="click" style="margin: 0 20px">
                  <el-link :underline="false">
                    <span class="el-icon--left">
                      <i class="iconfont iconicon_button_filtrate"></i>
                    </span>
                    筛选
                  </el-link>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item v-for="(item, index) in table" :key="index">
                      <el-checkbox v-model="item.status">{{
                        item.label
                        }}</el-checkbox>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </div>
            </div>
            <div v-loading="tableLoading" class="card_info" :style="style">
              <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="tableData" tooltip-effect="dark">
                <template v-for="(item, index2) in table">
                  <el-table-column v-if="item.status" :key="index2" :label="item.label" align="center" :min-width="item.width" :fixed="item.label =='操作'?'right':false">
                    <template slot-scope="scope">
                      <div v-if="item.label == '操作'">
                        <el-button class="bottom_one" size="mini" @click="pagesUpdate(scope.row, '修改' )">

                          编辑
                        </el-button>
                        <el-button class="bottom_one" size="mini" @click="execution(scope.row )">
                          立即执行
                        </el-button>
                        <el-button v-if="scope.row.transferStatus !== 1&&scope.row.transferStatus !== 2" size="mini" class="bottom_three" @click="update(scope.row.id , 1)">
                          <i class="icon iconfont iconicon_button_startuse" style="font-size: 12px"></i>
                          启用
                        </el-button>
                        <el-button v-if="scope.row.transferStatus !== 0&&scope.row.transferStatus !== 2" size="mini" class="bottom_four" @click="update(scope.row.id , 0)">
                          禁用
                        </el-button>
                      </div>
                      <div v-else-if="item.label =='状态'">
                        <span v-if="scope.row.transferStatus == 0" style="color: #969799">未启动</span>
                        <span v-if="scope.row.transferStatus == 1" style="color: #00a754">已启用</span>
                        <span v-if="scope.row.transferStatus == 2" style="color: #00a754">异常中断</span>
                      </div>
                      <span v-else>{{ scope.row[item.prop] }}</span>
                    </template>
                  </el-table-column>
                </template>
              </el-table>
            </div>
            <div class="card_bottom">
              <div class="card_bottom_left">
                <div class="top_page_totle">总共{{ total }}条</div>
                <el-pagination :current-page.sync="tableParam.page" :page-size="tableParam.pageSize" layout="prev, pager, next, jumper" :total="total" @current-change="gettableData()"></el-pagination>
              </div>
              <div>
                <el-button size="mini" icon="el-icon-refresh-right" class="bottom_all_two" @click="gettableData">刷新</el-button>
              </div>
            </div>
          </div>
        </div>
      </el-main>
    </el-container>
    <!-- 添加 -->
    <el-dialog v-dialogDrag :visible.sync="addDialog" width="980px" :close-on-click-modal="false" :before-close="reset">
      <span slot="title" class="dialog-title">{{ addDialogTitle }}</span>
      <div v-loading="loading" class="dialoginfo">
        <el-form ref="reffromDate" :rules="rules" :inline="true" :model="fromDate" label-width="120px">
          <div>
            <el-form-item prop="name">
              <span slot="label" style="color: #ff0000">任务名称：</span>
              <el-input v-model="fromDate.name" placeholder="请输入" clearable>
              </el-input>
            </el-form-item>
          </div>
          <el-form-item prop="sourceId">
            <span slot="label" style="color: #ff0000">选择源库：</span>
            <el-select ref="sourceId" v-model="fromDate.sourceId" placeholder="请选择" @change="change(fromDate.sourceId,'source')">
              <el-option v-for="(item, index) in datasourceList" :key="index" :label="item.name" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="sourceTable">
            <span slot="label" style="color: #ff0000">源库表：</span>
            <el-select v-model="fromDate.sourceTable" placeholder="请选择" filterable :disabled="source.length==0" @change="getItem(fromDate.sourceTable,fromDate.sourceId,'tableItem'),fromDate.tableFieldList=[]">
              <el-option v-for="(item, index) in source" :key="index" :value="item"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="targetId">
            <span slot="label" style="color: #ff0000">选择目标库：</span>
            <el-select v-model="fromDate.targetId" placeholder="请选择" @change="change(fromDate.targetId,'targetPrimaryFie')">
              <el-option v-for="(item, index) in datasourceList" :key="index" :label="item.name" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="targetTableshow">
            <span slot="label" style="color: #ff0000">目标库表：</span>
            <el-select v-model="fromDate.targetTableshow" placeholder="请选择" filterable :disabled="targetPrimaryFie.length==0" multiple @change="change1()">
              <el-option v-for="(item, index) in targetPrimaryFie" :key="index" :value="item"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="execCycle">
            <span slot="label" style="color: #ff0000">执行周期：</span>
            <el-input v-model="fromDate.execCycle" placeholder="请输入" type="Number" clearable>
              <template slot="append">秒</template>
            </el-input>
          </el-form-item>
          <el-form-item prop="maxCount">
            <span slot="label" style="color: #ff0000">最大同步条数：</span>
            <el-input v-model="fromDate.maxCount" placeholder="请输入" type="Number" clearable>
            </el-input>
          </el-form-item>
          <!-- 同步标识 -->
          <div style="color: #ff0000;padding:20px 0">同步标识</div>
          <div style="margin-bottom:18px">
            <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="[{}]" tooltip-effect="dark">
              <el-table-column align="center" label="源库表">
                <template>
                  <el-form-item prop="sourceCheckTable" style="margin:0">
                    <el-select v-model="fromDate.sourceCheckTable" style="width:100%" filterable placeholder="请选择" @change="getItem(fromDate.sourceCheckTable,fromDate.sourceId,'checkFieItem')">
                      <el-option v-for="(item, index) in source" :key="index" :value="item"></el-option>
                    </el-select>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column align="center" label="源库表主键字段">
                <template>
                  <el-form-item prop="sourcePrimaryKeyshow" style="margin:0">
                    <el-select v-model="fromDate.sourcePrimaryKeyshow" filterable style="width:100%" placeholder="请选择" multiple>
                      <el-option v-for="(item, index) in checkFieItem" :key="index" :value="item"></el-option>
                    </el-select>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column align="center" label="源库表标识字段">
                <template>
                  <el-form-item prop="sourceCheckField" style="margin:0">
                    <el-select v-model="fromDate.sourceCheckField" filterable style="width:100%" placeholder="请选择">
                      <el-option v-for="(item, index) in checkFieItem" :key="index" :value="item"></el-option>
                    </el-select>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column align="center" label="原值">
                <template>
                  <el-form-item prop="checkOldValue" style="margin:0">
                    <el-input v-model="fromDate.checkOldValue" style="width:100%" placeholder="请输入">
                    </el-input>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column align="center" label="同步成功值">
                <template>
                  <el-form-item prop="checkSuccessValue" style="margin:0">
                    <el-input v-model="fromDate.checkSuccessValue" style="width:100%" placeholder="请输入">
                    </el-input>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column align="center" label="同步异常值">
                <template>
                  <el-form-item prop="checkExceptionValue" style="margin:0">
                    <el-input v-model="fromDate.checkExceptionValue" style="width:100%" placeholder="请输入">
                    </el-input>
                  </el-form-item>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div style="margin-bottom:18px">
            <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="targetPrimaryFieldshow" tooltip-effect="dark">
              <el-table-column align="center" label="目标库表" prop="key"></el-table-column>
              <el-table-column align="center" label="目标库表存储主键值字段">
                <template slot-scope="scope">
                  <el-select v-model="scope.row.value" filterable placeholder="请选择" style="width:100%">
                    <el-option v-for="(item, index) in scope.row.list" :key="index" :value="item"></el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column align="center" label="目标库表序列号字段">
                <template slot-scope="scope">
                  <el-select v-model="scope.row.value1" filterable placeholder="请选择" style="width:100%">
                    <el-option v-for="(item, index) in scope.row.list" :key="index" :value="item"></el-option>
                  </el-select>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <!-- <el-form-item prop="transferStatus">
            <span slot="label" style="color: #ff0000">状态：</span>
            <el-radio-group v-model="fromDate.transferStatus">
              <el-radio :label="1">已启动</el-radio>
              <el-radio :label="0">未启动</el-radio>
            </el-radio-group>
          </el-form-item> -->
          <!-- 目标库 -->
          <div>
            <div style="padding-bottom:5px">
              <el-button size="small" class="bottom_all" style="margin-left: 0" :disabled="fromDate.sourceTable==''||fromDate.targetTableshow.length==0" @click="addItem()">
                <i class="icon iconfont iconicon_button_add" style="font-size: 12px"></i>
                添加
              </el-button>
            </div>
            <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="fromDate.tableFieldList" tooltip-effect="dark" :row-class-name="className">
              <el-table-column align="center" label="源库表">
                <template slot-scope="scope">
                  <div>
                    {{scope.row.sourceTable}}
                  </div>
                </template>
              </el-table-column>
              <el-table-column align="center" label="源库表字段">
                <template slot-scope="scope">
                  <el-select v-model="scope.row.sourceField" style="width:100%" filterable allow-create default-first-option placeholder="请选择">
                    <el-option v-for="item in tableItem" :key="item" :value="item">
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column align="center" label="目标库表">
                <template slot-scope="scope">
                  <el-select v-model="scope.row.targetTable" filterable style="width:100%" placeholder="请选择" @change="getItem1(scope.row,fromDate.targetId)">
                    <el-option v-for="item in fromDate.targetTableshow" :key="item" :value="item">
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column align="center" label="目标库表字段">
                <template slot-scope="scope">
                  <el-select v-model="scope.row.targetField" filterable style="width:100%" placeholder="请选择">
                    <el-option v-for="item in scope.row.list" :key="item" :value="item">
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column align="center" label="操作">
                <template slot-scope="scope">
                  <el-button size="mini" class="bottom_two" @click="delItem(scope.row,scope.$index)">
                    <i class="icon iconfont iconicon_button_delete" style="font-size: 12px"></i>
                    删除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="reset">取 消</el-button>
        <el-button class="bottom_all" :disabled="loading" style="margin-left: 24px" @click="pagessubmitFromDate()">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import mixin from "@/mixins/ICPSmixin.js";
import {
  queryPage,
  saveOrUpdate,
  update_status,
  get_list,
  get_table_list,
  get_field_list,
  exec_task,
  get_detail
} from "@/api/sync/syncTask.js";
import { sortReg } from "@/common/RegExp.js";
import { _debounce } from '@/utils/utils.js'
export default {
  mixins: [mixin],
  data() {
    var validatePass1 = (rule, value, callback) => {
      if (sortReg(value)) {
        callback();
      } else {
        callback(new Error("请输正整数序号!"));
      }
    };
    return {
      /*表格增删改查及下载接口*/
      queryPage: queryPage,
      saveOrUpdate: saveOrUpdate,
      /*表格数据*/
      table: [
        { label: "任务名称", width: "160", prop: "name", status: true },
        { label: "源库", width: "160", prop: "sourceCheckTable", status: true },
        { label: "目标库", width: "400", prop: "targetTable", status: true },
        { label: "执行周期（秒）", width: "120", prop: "execCycle", status: true },
        { label: "最后成功时间", width: "180", prop: "lastSuccessTime", status: true },
        { label: "状态", width: "160", prop: "", status: true },
        { label: "操作", width: "300px", prop: "", status: true },
      ],
      pagesType: 0,
      /*添加表单数据*/
      rules: {
        name: [{ required: true, message: "请输入任务名", trigger: "blur" }],
        sourceId: [{ required: true, message: "请选择源库", trigger: "change" }],
        sourceTable: [{ required: true, message: "请选择源库表", trigger: "change" }],
        targetId: [{ required: true, message: "请选择目标库", trigger: "change" }],
        targetTableshow: [{ required: true, message: "请选择目标库表", trigger: "change" }],
        execCycle: [{ required: true, message: "请输入执行周期", trigger: "blur" },
        { validator: validatePass1, trigger: "blur", }],
        maxCount: [{ required: true, message: "请输入执行周期", trigger: "blur" },
        { validator: validatePass1, trigger: "blur", }],
        sourceCheckTable: [{ required: true, message: "请选择同步源库表", trigger: "change" }],
        sourcePrimaryKeyshow: [{ required: true, message: "请选择源库表主键字段", trigger: "change" }],
        sourceCheckField: [{ required: true, message: "请选择源库表标识字段", trigger: "change" }],
        checkOldValue: [{ required: true, message: "请输入原值", trigger: "blur" }],
        checkSuccessValue: [{ required: true, message: "请输入同步成功值", trigger: "blur" }],
        checkExceptionValue: [{ required: true, message: "请输入同步异常值", trigger: "blur" }],
      },
      fromDate: {
        name: '',
        sourceId: '',
        targetId: '',
        execCycle: '',
        maxCount: '',
        sourceTable: '',
        sourceCheckTable: '',
        sourcePrimaryKeyshow: '',
        sourceCheckField: '',
        checkOldValue: '',
        checkSuccessValue: '',
        checkExceptionValue: '',
        tableFieldList: [],
        targetTableshow: [],
        transferStatus: 0
      },
      /**同步目标库*/
      targetPrimaryFieldshow: [],
      /**库*/
      datasourceList: [],
      /**源库*/
      source: [],
      /**目标库*/
      targetPrimaryFie: [],
      /**源库表字段*/
      checkFieItem: [],
      /**目标库表字段*/
      tableItem1: [],
      oldtableItem: [],
      /**源库表字段*/
      tableItem: [],
      loading: false
    };
  },
  created() {
    this.tableParam = { ...this.tableParam, name: "", transferStatus: '' };
    this.gettableData();
  },
  async activated() {
    /*存储拷贝的原初始化fromDate数据*/
    const { data } = await get_list()
    this.datasourceList = data
  },
  deactivated() {
    this.reset()
  },
  methods: {
    pagesaddFromDate(text) {
      this.targetPrimaryFieldshow = []
      this.source = []
      this.targetPrimaryFie = []
      this.checkFieItem = []
      this.tableItem1 = []
      this.oldtableItem = []
      this.tableItem = []
      this.loading = false
      this.addFromDate(text)
    },
    className({ row }) {
      if (row.status == 0) {
        return 'hidden'
      }
    },
    async pagesUpdate(low, text) {
      this.loading = true
      this.addDialog = true
      setTimeout(() => {
        this.$refs.reffromDate.clearValidate();
      }, 10)
      this.addDialogTitle = text
      const { data } = await get_detail({ dataTaskId: low.id })
      this.fromDate.name = data.name
      this.fromDate.sourceId = data.sourceId
      await this.change(this.fromDate.sourceId, 'source')
      this.fromDate.sourceTable = data.sourceTable
      await this.getItem(this.fromDate.sourceTable, this.fromDate.sourceId, 'tableItem')
      this.fromDate.targetId = data.targetId
      await this.change(this.fromDate.targetId, 'targetPrimaryFie')
      this.fromDate.targetTableshow = data.targetTable.split(',')
      this.fromDate.sourceCheckTable = data.sourceCheckTable
      await this.getItem(this.fromDate.sourceCheckTable, this.fromDate.sourceId, 'checkFieItem')
      this.fromDate.sourcePrimaryKeyshow = data.sourcePrimaryKey.split(',')
      this.fromDate.sourceCheckField = data.sourceCheckField
      this.fromDate.checkOldValue = data.checkOldValue
      this.fromDate.checkSuccessValue = data.checkSuccessValue
      this.fromDate.id = data.id
      this.fromDate.checkExceptionValue = data.checkExceptionValue
      this.targetPrimaryFieldshow = []
      for (let key in JSON.parse(data.targetPrimaryField)) {
        const { data: list } = await get_field_list({ table: key, sourceId: this.fromDate.targetId })
        this.targetPrimaryFieldshow.push({
          key: key, value: JSON.parse(data.targetPrimaryField)[key].split(',')[0], value1: JSON.parse(data.targetPrimaryField)[key].split(',')[1], list: list
        })
      }
      this.fromDate.execCycle = data.execCycle
      this.fromDate.maxCount = data.maxCount
      this.fromDate.tableFieldList = data.tableFieldList
      for (let data of data.tableFieldList) {
        await this.getItem1(data, this.fromDate.targetId)
      }
      this.loading = false
    },
    execution(low) {
      this.$confirm('此操作将立即执行该任务, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        cancelButtonClass: 'bottom_all_two',
        confirmButtonClass: 'bottom_all',
        type: 'warning'
      }).then(async () => {
        const { code } = await exec_task({ id: low.id })
        if (code == 1001) {
          this.$message({
            message: '任务已开始执行',
            type: 'success'
          });
          this.gettableData();
        }
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消执行任务'
        });
      });

    },
    reset() {
      this.targetPrimaryFieldshow = []
      this.source = []
      this.targetPrimaryFie = []
      this.checkFieItem = []
      this.tableItem1 = []
      this.oldtableItem = []
      this.tableItem = []
      this.loading = false
      this.resetFromDate()
    },
    /**添加同步数据*/
    addItem() {
      let obj = {
        sourceField: '',
        sourceTable: this.fromDate.sourceTable,
        targetField: '',
        targetTable: '',
        sourceType: '',
        list: []
      }
      this.fromDate.tableFieldList.push(obj)
    },
    delItem(low, index) {
      if (low.id) {
        low.status = 0
      } else {
        this.fromDate.tableFieldList.splice(index, 1)
      }

    },
    /**根据数据源id获取数据表*/
    async change(id, table) {
      const { data } = await get_table_list({ sourceId: id })
      this[table] = data
      if (this.loading) {
        return
      }
      if (table == 'targetPrimaryFie') {
        this.fromDate.targetTableshow = []
      }
      if (table == 'source') {
        this.fromDate.sourceTable = ''
        this.fromDate.sourceCheckTable = ''
        this.fromDate.sourcePrimaryKeyshow = []
        this.fromDate.sourceCheckField = ''
        this.fromDate.checkOldValue = ''
        this.fromDate.checkSuccessValue = ''
        this.fromDate.checkExceptionValue = ''
      }
    },
    change1: _debounce(function () {
      this.fromDate.tableFieldList = []
      this.targetPrimaryFieldshow = []
      let arr = this.copy(this.fromDate.targetTableshow)
      arr.forEach(async (res) => {
        const { data } = await get_field_list({ table: res, sourceId: this.fromDate.targetId })
        this.targetPrimaryFieldshow.push({
          key: res, value: '', value1: '', list: data
        })
      })
    }, 200),
    /**获取数据表字段*/
    async getItem(id, table, item) {
      const { data } = await get_field_list({ table: id, sourceId: table })
      this[item] = data
      if (item == 'tableItem') {
        this.oldtableItem = this.copy(data)
      }
    },
    async getItem1(low, table) {
      const { data } = await get_field_list({ table: low.targetTable, sourceId: table })
      low.list = data
      if (!this.loading) {
        low.targetField = ''
      }

    },

    /**状态修改*/
    async update(id, status) {
      const { code } = await update_status({ transferStatus: status, id: id })
      if (code == 1001) {
        this.$message({
          type: 'success',
          message: `${status == 0 ? '禁用成功' : '启用成功'}`
        });
        this.gettableData();
      }
    },
    /*重置数据,此方法必须存在，并且方发只重置条件*/
    init() {
      this.tableParam.name = "";
      this.tableParam.transferStatus = ""
      this.gettableData();
    },
    pagessubmitFromDate() {
      let _this = this;
      _this.$refs.reffromDate.validate((valid) => {
        if (valid) {
          if (_this.targetPrimaryFieldshow.every(res => (res.value == '' || res.value1 == ''))) {
            _this.$message({
              message: '警告哦，请填写完整的同步标识',
              type: 'warning'
            });
            return
          }
          if (_this.fromDate.tableFieldList.length == 0) {
            _this.$message({
              message: '警告哦，至少选择一条数据进行同步',
              type: 'warning'
            });
            return
          }
          if (_this.fromDate.tableFieldList.every(res => (res.sourceField == '' || res.targetTable == '' || res.targetField == ''))) {
            _this.$message({
              message: '警告哦，请填写完整的同步数据',
              type: 'warning'
            });
            return
          }

          _this.fromDate.sourcePrimaryKey = _this.fromDate.sourcePrimaryKeyshow.join(',')
          _this.fromDate.targetTable = _this.fromDate.targetTableshow.join(',')
          _this.fromDate.targetPrimaryField = new Object()
          _this.targetPrimaryFieldshow.forEach(res => {
            _this.fromDate.targetPrimaryField[res.key] = res.value + ',' + res.value1
          })
          _this.fromDate.targetPrimaryField = JSON.stringify(_this.fromDate.targetPrimaryField)
          _this.fromDate.tableFieldList.forEach(res => {
            delete res.list
            if (_this.oldtableItem.indexOf(res.sourceField) == -1) {
              res.sourceType = 'type_custom'
            } else {
              res.sourceType = 'type_field'
            }
          })
          this.console(_this.fromDate)
          _this.submitFromDate();
        } else {
          return false;
        }
      });
    },
  },
};
</script>
<style lang="scss" >
.hidden {
  display: none;
}
</style>

<style lang="scss" scoped>
.el-input,
.el-select {
  width: 280px;
}

/*
 <el-link class="table_link" :underline="false">查看配合比</el-link>*/
.table_link {
  margin: 0 10px;
  color: $bg_color;
  cursor: pointer;
}

.table_link:hover {
  opacity: 0.8;
}
</style>
